
<!DOCTYPE html>
<html>
  <head>
    <title>满意度调查</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <link rel="stylesheet" href="//cdn.bootcss.com/weui/0.4.3/style/weui.min.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/jquery-weui/0.8.0/css/jquery-weui.min.css">
    <link rel="stylesheet" href="/static/css/myd.css">
  </head>
  <body ontouchstart>

    <div class="content">
        <form id="form" class="uc-life-form store-data" >
        <input type="hidden" name="do" value="<{$action}>" />
        <input type="hidden" name="bc_id" value="<{$bingchuang.id}>" />
        <input type="hidden" name="count" value="<{$count}>" />
        <input type="hidden" name="ids" value="<{$ids}>" />

        <input type="hidden" name="submit_token" value="<{$submit_token}>">

        <div class="weui_cells weui_cells_form">
            <div class="weui_cell">
              <div class="weui_cell_bd weui_cell_primary">
                <p>各位患者:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为了了解“<{$company.name}>“向社会和广大群众提供医疗服务的情况,真实、客观地对“<{$company.name}>“进行评价，请您根据亲身经历或感受，在您认为适宜的序号上划“√”，谢谢合作！</p>
              </div>
            </div>

            <div class="weui_cell">
              <div class="weui_cell_hd"><label class="weui_label">科室</label></div>
              <div class="weui_cell_bd weui_cell_primary">
                <{$zone.name}>
              </div>
            </div>
            <div class="weui_cell">
              <div class="weui_cell_hd"><label class="weui_label">病床</label></div>
              <div class="weui_cell_bd weui_cell_primary">
                <{$bingchuang.name}>
              </div>
            </div>
            <!-- <div class="weui_cell">
              <div class="weui_cell_hd"><label class="weui_label">姓名</label></div>
              <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" id='user_name' name="user_name" type="text" placeholder="请输入姓名" value="">
              </div>
            </div> -->
            <!-- <div class="weui_cell">
              <div class="weui_cell_hd"><label class="weui_label">手机号</label></div>
              <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" id='user_tel' name="user_tel" type="tel" placeholder="请输入手机号" value="">
              </div>
            </div> -->


            <{if $list}>
            <{foreach $list as $val}>
            <div class="weui_cell">
              <div class="weui_cell_bd weui_cell_primary" id="A<{$val.id}>">
                <h3><{$val.i}>、<{$val.title}>[#<{$val.id}>]</h3>
              </div>
            </div>
            <{if $val.options}>
            <div class="weui_cells_checkbox">
              <{foreach $val.options as $k => $v}>
                <{if $v}>
                <label class="weui_cell weui_check_label" for="x<{$val.id}>_<{$k}>">
                  <div class="weui_cell_bd">

                    <input type="radio" class="satisfaction-btn weui_check" name="log[A<{$val.id}>]" id="x<{$val.id}>_<{$k}>" value="<{$val.id}>,<{$v}>" data-id="<{$val.id}>" data-text="<{$v}>"  data-ismanyi="<{$val.is_manyi}>">

                    <span class="weui_icon_checked"></span>
                  </div>
                  <div class="weui_cell_bd weui_cell_primary">
                    <p><{$v}></p>
                  </div>
                </label>
                <{if $val.is_manyi}>

                  <{if $v =='不满意' || $v =='否'}>
                  <div class="weui_cells_form" id="x<{$val.id}>_intro" style="display:none;">
                    <div class="weui_cell">
                      <div class="weui_cell_bd weui_cell_primary">
                        <textarea class="weui_textarea" placeholder="请输入具体内容" rows="3" name="log2[A<{$val.id}>]"></textarea>
                        <div class="weui_textarea_counter"></div>
                      </div>
                    </div>
                  </div>
                  <{/if}>

                <{else}>

                  <{if $v =='不满意' || $v =='是'}>
                  <div class="weui_cells_form" id="x<{$val.id}>_intro" style="display:none;">
                    <div class="weui_cell">
                      <div class="weui_cell_bd weui_cell_primary">
                        <textarea class="weui_textarea" placeholder="请输入具体内容" rows="3" name="log2[A<{$val.id}>]"></textarea>
                        <div class="weui_textarea_counter"></div>
                      </div>
                    </div>
                  </div>
                  <{/if}>

                <{/if}>
              <{/if}>
              <{/foreach}>
            </div>
            <{/if}>
            <{/foreach}>
            <{/if}>

            <div class="weui_cell">
              <div class="weui_cell_bd weui_cell_primary">
                <p>请写下您的具体意见或建议:</p>
              </div>
            </div>
            <div class="weui_cells_form">
              <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                  <textarea class="weui_textarea" placeholder="请输入内容" rows="3" name="intro"></textarea>
                  <div class="weui_textarea_counter"></div>
                </div>
              </div>
            </div>

            <!-- <div class="weui_cell">
              <div class="weui_cell_hd"><label class="weui_label">手机号</label></div>
              <div class="weui_cell_bd weui_cell_primary">
                <input class="weui_input" id='tel' name="tel" type="tel" placeholder="请输入手机号" value="">
              </div>
            </div> -->


        </div>


        <div class='demos-content-padded' id="add-submit">
          <a class="weui_btn weui_btn_primary" href="javascript:">提交</a>
        </div>
        <br /><br /><br />
        </form>
    </div>

  <script src="//cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
  <script src="//cdn.bootcss.com/jquery-weui/0.8.0/js/jquery-weui.min.js"></script>
   <script>

    $(document).ready(function() {
      // 隐藏输入框的初始状态
      $("#input-container").hide();

      // 监听每个按钮的点击事件
      $('.satisfaction-btn').click(function() {
          var id = $(this).data('id');
          var text = $(this).data('text');
          var intro = 'x' + id + '_intro';

          var ismanyi = $(this).data('ismanyi');
          if(ismanyi){

            if( text =='不满意' || text =='否'){
              $("#" + intro).show();
            }else{
              $("#" + intro).hide();
            }

          }else{

            if( text =='不满意' || text =='是'){
              $("#" + intro).show();
            }else{
              $("#" + intro).hide();
            }

          }

      });

      // 监听提交按钮的点击事件
      // $('#submit-reason').click(function() {
      //     var reason = $('#reason').val(); // 获取用户输入的原因
      //     if (reason) { // 如果用户输入了原因
      //         alert("感谢您的反馈，不满意的原因：" + reason); // 显示反馈信息，实际应用中可能需要发送到服务器
      //         $('#input-container').hide(); // 隐藏输入框
      //         $('#reason').val(''); // 清空输入框内容
      //     } else {
      //         alert("请输入您不满意的原因！"); // 提醒用户输入原因
      //     }
      // });



      $("#add-submit").click(function(e){
          var $button = $(this);
          if($button.hasClass('disabled')) {
            //return false;
          }
        // var tel = $("#tel").val();
        // if(!tel || !/1[3|4|5|7|8]\d{9}/.test(tel)){
        //     $.toptip('请输入手机号');
        //     return;
        // }

        e.preventDefault();
        var data = $('#form').serializeArray();
        $button.addClass('disabled');
        $.post("/diaocha/<{$action}>", data, function(res){

          if(res.code == 0){
            $button.removeClass('disabled');
            if(res.msg=='请完成全部选项'){
              $.alert(res.msg);
              $('html,body').animate({scrollTop:$(res.url).offset().top}, 1000);
            }else{
              $.alert(res.msg);
            }
            return;
          }
          if(res.code == 1){
            // $.toast(res.msg, res.url);
            $.toast(res.msg, 1000, 'success top');
            setTimeout(function () {
              window.location.href = res.url;
            }, 1000);
            return;
          }
        });

      });
  });


    </script>

  </body>
</html>
